home *** CD-ROM | disk | FTP | other *** search
- From news.primenet.com!nntp.news.primenet.com!news.sprintlink.net!gryphon.phoenix.net!academ!binky.capnet.state.tx.us!goblin.tdh.state.tx.us!geraldo.cc.utexas.edu!cs.utexas.edu!uwm.edu!math.ohio-state.edu!howland.reston.ans.net!newsfeed.internetmci.com!sgigate.sgi.com!news1.best.com!news.aimnet.com!ns2.mainstreet.net!sloth.swcp.com!news.dgsys.com!DGS.dgsys.com!raymoon Tue Apr 2 15:45:00 1996
- Path: news.primenet.com!nntp.news.primenet.com!news.sprintlink.net!gryphon.phoenix.net!academ!binky.capnet.state.tx.us!goblin.tdh.state.tx.us!geraldo.cc.utexas.edu!cs.utexas.edu!uwm.edu!math.ohio-state.edu!howland.reston.ans.net!newsfeed.internetmci.com!sgigate.sgi.com!news1.best.com!news.aimnet.com!ns2.mainstreet.net!sloth.swcp.com!news.dgsys.com!DGS.dgsys.com!raymoon
- From: raymoon@dgsys.com (Raymond Moon)
- Newsgroups: alt.lang.asm,comp.lang.asm.x86,news.answers,alt.answers,comp.answers
- Subject: x86 Assembly Language FAQ - Borland TASM
- Supersedes: <4gdsot$o9c@news.dgsys.com>
- Followup-To: alt.lang.asm,comp.lang.asm.x86
- Date: 21 Mar 1996 22:51:53 GMT
- Organization: MoonWare
- Lines: 340
- Approved: news-answers-request@MIT.EDU
- Distribution: world
- Expires: Sat, 20 Apr 1996 23:59:59 GMT
- Message-ID: <4ismi9$2tq@news.dgsys.com>
- Reply-To: raymoon@moonware.dgsys.com
- NNTP-Posting-Host: dgs.dgsys.com
- Summary: This is the FAQ for the x86 Assembly Language programmers for the
- alt.lang.asm and comp.lang.asm.x86 newsgroups. This particular section of
- the FAQ contains x86 assembly information specific to the Borland TASM
- assembler.
- Keywords: x86 Assemby Language ASM FAQ Borland TASM
- X-Newsreader: TIN [version 1.2 PL2]
- Xref: news.primenet.com alt.lang.asm:8424 comp.lang.asm.x86:18601 news.answers:66834 alt.answers:16276 comp.answers:17533
-
- Archive-name: assembly-language/x86/borland
- Posting-Frequency: monthly (21st of every month)
- Last-modified: 1996/02/19
-
- ------------------------------
-
- Subject: 1. Introduction and Intent
-
- This is the x86 Assembly Language FAQ for the comp.lang.asm.x86 and
- alt.lang.asm newsgroups. This FAQ is posted monthly on or about the 21st
- of the month on both newsgroups and news.answers, alt.answers and
- comp.answers. It also is archived at the normal FAQ archival sites and the
- SimTel mirror sites in the msdos/info directory. Lastly, the current
- version is available from my web page as:
- http://www2.dgsys.com/~raymoon/faq/asmfaq.zip
- Currently, this FAQ is broken into six sections. The following are the
- section filenames and the scope of each section of the FAQ.
-
- assembly-language/x86/general/part1 - This is the basic portion of the FAQ
- that contains information of interest to all assembly language
- programmers. In general, the information contained in this portion of
- the FAQ is not specific to any particular assembler.
-
- assembly-language/x86/general/part2 - This is a continuation of the above
- FAQ.
-
- assembly-language/x86/general/part3 - This is a continuation of the above
- FAQ.
-
- assembly-language/x86/microsoft - This portion of the FAQ contains
- information specific for the Microsoft MASM.
-
- assembly-language/x86/borland - This portion of the FAQ contains
- information specific for the Borland TASM.
-
- assembly-language/x86/a86 - This portion of the FAQ contains information
- specific for the Shareware A86 Assembler and D86 Debugger.
-
- The scope and content of this FAQ is to go beyond just answering the
- frequently asked questions. I am including pointers to assembly language
- treasure troves that are hidden out on the internet. I believe that this
- will enhance the FAQ's value not only to the novices but also to the old
- hands.
-
- Any subject listed as "OPEN" means that this topic as been requested but no
- one has come forth and volunteered to write this section. Volunteers
- please indicate your intentions to the author listed below either by
- posting to either newsgroup or by sending e-mail to the author at the below
- address.
-
- The general guidelines for submission are:
- * accuracy and conciseness;
- * pointers to where on the internet more detailed information is
- available; and
- * any code submitted will be generic so that most assemblers can assemble
- successfully.
-
- Any subject listed as "UNDER CONSTRUCTION" has a volunteer currently
- writing that subject. If you desire to assist or have some information
- that you believe would be of help in writing that particular subject,
- contact the contributor of that subject or post to both newsgroups. Once a
- subject is submitted to me, I will post it on both newsgroups for comment.
- After any changes that may be necessary are made, I will include it in the
- next posting of the FAQ.
-
- For the ease of determining what has changed since the last FAQ, the Table
- of Contents will have "REVISED" at the end of the subject line for all
- revised subjects. If more than one FAQ revision has been missed, the "Last
- Changed:" entry at the end of each subject can be used to determine which
- subjects have been revised during the intervening time frame.
-
- The information in this FAQ is free for all to use as long as you
- acknowledge the source. This FAQ can be reproduced in part or in its
- entirety as long as the copyright is included. This FAQ can be made
- available on public servers, like ftp, gopher or WWW servers. Please do
- not modify the file, such as converting it into some other format, without
- prior permission of the author.
-
- All references to files and locations are in Uniform Resource Locators
- (URLs) format. Some web browser will be able to use these URLs directly as
- hot links. If the format is not clear to you, get RFC 1738. It is
- available from: ftp://is.internic.net/rfc/rfc1738.txt
-
- Suggestions for changes and comments are always welcome. They can be
- posted to either newsgroup or e-mailed directly to the me.
-
- Author: Raymond Moon, raymoon@moonware.dgsys.com
- Copyright 1996 - Raymond Moon
- ALL RIGHTS RESERVED
- Last Changed: 17 Feb 96
-
- ------------------------------
-
- Subject: 2. Table of Contents
-
- 1. Introduction And Intent
- 2. Table Of Contents
- 3. TASM Ideal Mode
- 4. Borland TASM Information
- 5. Borland tools/Windows 95 Interworking Patches Available
- 6. Borland TASM List Server
-
- ------------------------------
-
- Subject: 3. TASM Ideal Mode
-
- 3.1 SUMMARY
-
- TASM, Borland's assembler, supports an alternative to MASM emulation. This
- is known as Ideal mode and provides several advantages over MASM. The key
- (questionable) disadvantage, of course, is that MASM style assemblers
- cannot assemble Ideal mode programs.
-
- 3.2 MEMORY CONTENTS
-
- Square brackets are used consistently to refer to memory contents. Notice
- that size qualifiers are not necessary when TASM has enough information by
- context to figure out the data size involved. Here are some examples
- without segment details:
-
- ByteVal db ? ; "ByteVal" is name of byte variable
-
- mov ax, bx ; OK: Move value of BX to AX
-
- mov ax, [bx] ; OK: Move word at address BX to AX. Size of
- ; destination is used to generate proper object
- ; code
-
- mov ax, [word bx] ; OK: Same as above with unnecessary size
- ; qualifier
-
- mov ax, [word ptr bx]
- ; OK: Same as above with unnecessary size
- ; qualifier and redundant pointer prefix
-
- mov al, [bx] ; OK: Move byte at address BX to AL. Size of
- ; destination is used to generate proper object
- ; code
-
- mov [bx], al ; OK: Move AL to location BX
-
- mov ByteVal, al ; Warning: "ByteVal" needs brackets
-
- mov [ByteVal], al ; OK: Move AL to memory location named "ByteVal"
-
- mov [ByteVal], ax ; Error: unmatched operands
-
- mov al, [bx + 2] ; OK: Move byte from memory location BX + 2 to
- ; AL
-
- mov al, bx[2] ; Error: indexes must occur with "+" as above
-
- mov bx, Offset ByteVal
- ; OK: Offset statement does not use brackets
-
- mov bx, Offset [ByteVal]
- ; Error: offset cannot be taken of the contents
- ; of memory
-
- lea bx, [ByteVal] ; OK: Load effective address of "ByteVal"
-
- lea bx, ByteVal ; Error: brackets required
-
- mov ax, 01234h ; OK: Move constant word to AX
-
- mov [bx], 012h ; Warning: size qualifier needed to determine
- ; whether to populate byte or word
-
- mov [byte bx], 012h
- ; OK: constant 012h is moved to byte at address
- ; BX
-
- mov [word bx], 012h
- ; OK: constant 012h is moved to word at address
- ; BX
-
- STRUCTURE REFERENCES
-
- Ideal mode handles structured records beautifully. When referring to
- structure members the dot operator is used. The name to the left of the
- dot is always the address of a structure and the name to right is always a
- structure member. Ideal mode permits member names to be duplicated in
- different structures. Here is a simple example, again without segment
- details:
-
- Struc PosType
- Row dw ?
- Col dw ?
- Ends PosType
-
- Union PosValType
- Pos PosType ?
- Val dd ?
- Ends PosValType
-
- Point PosValType ?
-
- mov [Point.Pos.Row], bx ; OK: Move BX to Row component of Point
-
- mov [Point.Pos.Row], bl ; Error: mismatched operands
-
- INDIRECTION
-
- Ideal mode enforces type-size checking even with indirected references.
- Using the above structure, here is how indirection is handled. BX is
- assumed to point to an instance of PosValType in memory. Indirection is
- used frequently when pointers are passed to procedures.
-
- mov [(PosValType bx).Pos.Row], ax
- ; OK: Move AX to Row component of PosValType instance
- ; pointed to by BX
-
- mov [bx + PosValType.Pos.Row], ax
- ; OK: same as above
-
- mov [bx + PosValType.Pos.Row], al
- ; Error: mismatched operands
-
- SEGMENT GROUPS
-
- The Offset operator always evaluates the offset of a data instance relative
- to its group, not its segment. This allows Offset to be used without
- qualifying each reference with the appropriate group name. Labels in a
- segment could be used to determine segment offsets if needed.
-
- RESOURCES
-
- Books and files which will be of interest to programmers wishing to know
- more about the Ideal mode of Borland's TASM assembler include the
- following:
-
- Turbo Assembler User's Guide / Borland International.
- ------------------------------------------------------------------
- Naturally, this is the definitive text on Ideal mode. Its focus is
- strictly on using TASM; it does not cover assembly language or the x86
- instruction set. Exasperatingly, the examples in the book all use MASM
- emulation mode, and only one of the four complete program examples
- included with TASM (at least version 3.1) uses Ideal mode. The example
- that does use Ideal mode is a very flexible WHEREIS program. Studying
- this 13 file example should be sufficient for anyone wishing to
- understand Ideal mode.
-
- Mastering Turbo Assembler / Tom Swan.
- Indianapolis, IN: Hayden Books, c 1989.
- -----------------------------------------------------------------------
- This book is not just another Microsoft Assembler book reprinted with a
- Turbo Assembler cover. Swan uses and promotes Ideal mode throughout.
- This is a great beginning text for programmers who are still hassling
- with the ubiquitous non-reentrant interrupt handler known as DOS. It
- includes an overview of the x86 instruction set.
-
- SKEL32.ZIP / Bill Magaletta.
- Obtainable by ftp at hobbes.nmsu.edu:/os2/32bit/program as well as
- ftp-os2.cdrom.com and CompuServe
- -----------------------------------------------------------------------
- This is a standalone 32 bit OS/2 Ideal mode program, the simplicity of
- which will make converts of DOS programmers dealing with interrupts and
- segments. It includes an overview of the initial register states of
- DOS and OS/2 programs. This example illustrates the fact that TASM for
- DOS can be used to produce object files for OS/2.
-
- Contributor: Kurt Jung, kwjung@vela.acs.oakland.edu
- Last changed: 17 Jan 95
-
- ------------------------------
-
- Subject: 4. Borland TASM Information
-
- 4.1 Borland FTP Site
-
- Borland maintains a ftp site which has a directory dedicated to TASM. Most
- entries are patches and HOW-TOs, but there is a shell for TSRs that will
- load and unload either high or low.
-
- ftp://ftp.borland.com/pub/techinfo/techdocs/language/tools/turboasm
-
- 4.2 Borland Web Site
-
- At Borland's Web Site, I only could find product and ordering information
- on TASM. The only reference to technical information was a pointer to
- Borland's ftp site.
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last changed: 11 Nov 95
-
- ------------------------------
-
- Subject: 5. Borland tools/Windows 95 Interworking Patches Available
-
- 5.1 TASM32/H2ASM/H2ASM32 FAIL UNDER WINDOWS95
-
- Using the 32bit tools from Borland C++ 4.5 / TASM 4.0 under Windows 95 can
- fail when the DOS based tools tools are called from the Windows IDE.
-
- The nature of the problem is that any attempt to specify a commands file
- using the @ style argument will fail due to an incompatability between
- Windows 95 long filenames, and the TASM32.EXE file-open code.
-
- Note that by default the Borland C++ 4.5 IDE uses the @ directive for
- launching TASM32.EXE if 32bit instructions (which are not handled by the
- inline C++ assembler) are encountered in a user's source.
-
- Although the Borland tools reportedly use the PowerPack DPMI extensions for
- their 32bit operation, user applications which use the Powerpack libraries
- do not seem to be affected by this problem.
-
- A patch is available to correct this issue from location:
- ftp://ftp.borland.com/pub/techinfo/techdocs/language/tools/turboasm/ta4p01.zip
-
- This should be applied using the patcher executable from location:
- ftp://ftp.borland.com/pub/techinfo/techdocs/language/cpp/bcpp/patch/patch.zip
-
- Contributor: Iain Barker, ibarker@bnr.ca
- Last changed: 19 Feb 96
-
- ------------------------------
-
- Subject: 6. Borland TASM List Server
-
- 6.1 DESCRIPTION
-
- There is a list server available that is devoted to Borland's TASM
- Assembler.
-
- 6.2 JOINING
-
- To join send e-mail to:
- listserv%brufpb.bitnet@listserv.net
- with the phrase
- subscribe TASM-L your name
- in the text.
-
- 6.3 SENDING E-MAIL TO ALL MEMBERS
-
- To send e-mail to all members, send the e-mail to:
- tasm-l%brufpb.bitnet@listserv.net
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last changed: 17 Feb 96
-
-
-